/**
 * 缓存函数的返回结果。
 * Author: david.deng<david.deng@jcinfotech.com>
 * Date: 2018/6/20
 */

export function RememerHelper(func): any {
  const cached = Object.create(null);
  return function (...arg) {
    let key = JSON.stringify(arg);
    key = key || 'KEY';
    if (cached[key] === undefined) {
      cached[key] = func(...arg);
    }
    return cached[key];
  };
}
